#!/bin/sh -e

# if we do not have debconf, we just skip this
. /usr/share/debconf/confmodule || exit 0

db_version 2.0
db_title "Rivendell configuration"

# FIXME: initially, I am not going to even try to parse the config file and retreive the previous settings.  ... for now, take values from user and generate the config file.  The config file is windows style, and I do not know a decent parser for that (maybe make a python script ;-D).


# debconf enable or not
db_input high rivendell/debconfenable || true
db_go

# If user doesn't want to use debconf then leave...
db_get rivendell/debconfenable || true
if [ "$RET" = "false" ]; then
	exit 0
fi

# general Rivendell questions
db_input high rivendell/postrm_remove_data || true
db_go

db_input high rivendell/run_mode || true
db_go


# Identify section
db_input high rivendell/identity/password || true
db_go

db_input high rivendell/identity/audioowner || true
db_go

db_input high rivendell/identity/audiogroup || true
db_go

# Format section
db_input high rivendell/format/samplerate || true
db_go

db_input medium rivendell/format/channels || true
db_go

# MySQL section
db_input high rivendell/mysql/hostname || true
db_go

db_input high rivendell/mysql/loginname || true
db_go

# Populate the password with the value entered above.
db_get rivendell/identity/password
db_set rivendell/mysql/password $RET
db_input high rivendell/mysql/password || true
db_go

db_input medium rivendell/mysql/database || true
db_go

db_input low rivendell/mysql/driver || true
db_go

# CAE section
db_input medium rivendell/cae/audioroot || true
db_go

db_input medium rivendell/cae/audioextension || true
db_go

db_input low rivendell/cae/allownonstandardrates || true
db_go

# Tuning section
db_input low rivendell/tuning/userealtime || true
db_go

# RDAirPlay section
db_input low rivendell/rdairplay/logfile || true
db_go

# RDCatchd section
db_input low rivendell/rdcatchd/logfile || true
db_go

# Ripcd section
db_input low rivendell/ripcd/logfile || true
db_go

# Caed section
db_input low rivendell/caed/logfile || true
db_go

# Audio adapters section
db_input high rivendell/audioadapters/selections || true
db_go

db_get rivendell/audioadapters/selections || true
if  echo "$RET" | grep -s ALSA &> /dev/null ; then
    db_input high rivendell/audioadapters/alsaintro || true
fi

# Introduction
db_input high rivendell/intro || true
db_go

# vim:tabstop=4:expandtab:shiftwidth=4
